#ifndef CD3D10Device_h__
#define CD3D10Device_h__

#include "Common/CommonTypes.h"
#include "HardwareResource.h"

class CVertexBuffer;
class CIndexBuffer;

class CD3D10RenderDevice
{
public:
	CD3D10RenderDevice();
	~CD3D10RenderDevice();

	bool Init(HWND hMainWnd, int nViewWidth, int nViewHeight);
	void UnInit();

	void OnWindowResize(int nViewWidth, int nViewHeight);
	void OnResetDevice();

	void Present();
	void ShowText(const std::wstring& wstrFrameStats, RECT* pRect, const D3DXCOLOR& color);
	
	void DrawIndexedPrimitiveList(
		CVertexBuffer* pVertexBuffer, CIndexBuffer* pIndexBuffer, UINT32 dwVertexOffset, UINT32 dwIndexOffset);

	void ClearScene();

	void ResetViewport();
	void ResetRenderTargets();

	ID3D10Device*   GetDevice()     { return m_pDevice;    }
	IDXGISwapChain* GetSwapChain()  { return m_pSwapChain; }	

private:
	ID3D10Device*                  m_pDevice;
	IDXGISwapChain*                m_pSwapChain;
	ID3D10Texture2D*               m_pDepthStecilBuffer;
	ID3D10RenderTargetView*        m_pRenderTargetView;
	ID3D10DepthStencilView*        m_pDepthStencilView;
	ID3DX10Font*                   m_pFont;

	D3D10_DRIVER_TYPE              m_eD3DDriverType;

	int                            m_nViewWidth;
	int                            m_nViewHeight;
};


#endif // CD3D10Device_h__
